<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<s:set scope="session" name="SESSION_PAGE" value="createCard" />
<table width="722" border="0" cellpadding="0" cellspacing="0" class="bg2">
	<tr>
    	<td width="100%" valign="top">
			<table width="100%" height="40" border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td class="font02">ขั้นตอนที่ 1 เลือกรูปแบบนามบัตร</td>
				</tr>
			</table>
			<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="font03">
				<tr>
					<td>1. กรุณาเลือกแบบนามบัตรที่ท่านต้องการด้านล่าง</td>
				</tr>
				<tr>
					<td>2. คลิกปุ่ม ขั้นตอนต่อไป เพื่อดำเนินการในขั้นตอนต่อไป</td>
				</tr>
				<tr>
        			<td>&nbsp;</td>
      			</tr>
      			<tr>
        			<td>&nbsp;</td>
      			</tr>
			</table>
			<%-- 
			<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
				<tr>
					<td width="50%">&nbsp;</td>
				    <td width="50%" align="right">
				    	<a href="#" onclick="doPickTemplateForm();" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('next01','','${ imageBase }/b_next2.gif',1)"><img src="${ imageBase }/b_next1.gif" title="ขั้นตอนต่อไป" width="126" height="33" id="next01"></a>
				    </td>
				</tr>
			</table>
			--%>
		</td>
	</tr>
	<tr>
		<td>
			<form action="createCard-fillData.htm" method="POST" name="pickTemplateForm" id="pickTemplateForm">
			<s:include value="cardCreateBeanInclude.jsp" />
			<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
    			<tr class="font04">
        			<td>
						<label>
 							<input type="radio" name="cardCreateBean.printType" value="0" id="radioPrintType0"
 							<s:if test='%{cardCreateBean.printType eq "0"}'>
 							checked="checked"
 							</s:if>
 							>
							พิมพ์หน้าเดียว (ไทย)
						</label>
							
						<label>
							<input type="radio" name="cardCreateBean.printType" value="2" id="radioPrintType2"
 							<s:if test='%{cardCreateBean.printType eq "2"}'>
 							checked="checked"
 							</s:if>
							>
   							พิมพ์สองหน้า (ไทย-อังกฤษ)
  						</label>
						<label for="textfield3"></label>
           			</td>
       			</tr>
     		</table>
			<s:iterator value="listAvaiTemplate" var="availTemplate">
			<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
				<tr>
					<td height="40" colspan="2" align="left" valign="bottom">
						<label>
						<span class="font02"><s:property value="mtpName" /> </span>
						<input type="radio" name="selectedTemplate.mtpId" 
							id="radioMtpId<s:property value="mtpId"/>"
							value="<s:property value="mtpId"/>"
							onclick="onSelectTemplate(value)"
							<s:if test="selectedTemplate.mtpId eq mtpId"> 
							checked="checked"
							</s:if> />
						</label>
						<input type="hidden" id="mtpId<s:property value="mtpId"/>" value="<s:property value="mtpId"/>" /> 
						<input type="hidden" id="mtpPath<s:property value="mtpId"/>" value="<s:property value="mtpPath"/>" /> 
						<input type="hidden" id="mtpImgRequired<s:property value="mtpId"/>" value="<s:property value="mtpImgRequired"/>" />
					</td>
				</tr>
				<tr>
					<td valign="bottom" height="25" align="left" colspan="2">
						<span class="font03"><s:property value="mtpDescription" /></span>
					</td>
				</tr>
				<tr>
					<td width="50%" valign="top">
						<table width="315" height="30" border="0" align="center" cellpadding="0" cellspacing="0">
							<tr>
								<td class="font01">ด้านภาษาไทย</td>
							</tr>
						</table>
						<table border="0" align="center" cellpadding="0" cellspacing="0">
							<tr>
								<td>
									<img src="${request.appBase}<s:property value="mtpPath"/>-th.png" width="315" height="191">
								</td>
							</tr>
						</table>
					</td>
					<td width="50%" valign="top">
						<table width="315" height="30" border="0" align="center" cellpadding="0" cellspacing="0">
		            		<tr>
		                    	<td class="font01">ด้านภาษาอังกฤษ</td>
		            		</tr>
                  		</table>
                		<table border="0" align="center" cellpadding="0" cellspacing="0">
                  			<tr>
	                        	<td>
									<img src="${request.appBase}<s:property value="mtpPath"/>-en.png" width="315" height="191">
								</td>
	                   		</tr>
	                    </table>
					</td>
				</tr>
				<tr>
					<td height="20" colspan="2">&nbsp;</td>
				</tr>
                <tr>
           			<td height="40" colspan="2" valign="top"><hr width="100%" size="1"></td>
                </tr>
   			</table>
			</s:iterator>
			<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
				<tr>
					<td width="50%">&nbsp;</td>
				    <td width="50%" align="right">
				    	<a href="#" onclick="doPickTemplateForm();" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('next01','','${ imageBase }/b_next2.gif',1)"><img src="${ imageBase }/b_next1.gif" title="ขั้นตอนต่อไป" width="126" height="33" id="next01"></a>
				    </td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<script>
	function doPickTemplateForm() {
		var rules = new Array();
		rules[0] = 'selectedTemplate.mtpId:รูปแบบ|required';

		//if (yav.performCheck('loginForm', rules, 'inline')){
		if (yav.performCheck('pickTemplateForm', rules, 'classic')) {
			if($j("#mtpId").val()==''){
				onSelectTemplate($j(":radio[name^='selectedTemplate']:checked").val());
			}
			$j("#pickTemplateForm").submit();
		}
	}
	function onSelectTemplate(mtpId) {
		//alert(mtpId + ' ' + $j("#mtpId").val());
		$j("#mtpId").val($j("#mtpId" + mtpId).val());
		//alert($j("#mtpId").val());
		//$j("#selectedMtpName").val($j("#mtpName" + mtpId).val());
		//$j("#selectedMtpDescription").val($j("#mtpDescription" + mtpId).val());
		$j("#mtpPath").val($j("#mtpPath" + mtpId).val());
		$j("#mtpImgRequired").val($j("#mtpImgRequired" + mtpId).val());
	}
</script>